package com.ruoyi.project.jiaqin.companyinfo.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.jiaqin.companyinfo.domain.CompanyInfo;
import com.ruoyi.project.jiaqin.companyinfo.mapper.CompanyInfoMapper;
import com.ruoyi.project.jiaqin.companyinfo.service.ICompanyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

/**
 * 企业简介Service业务层处理
 *
 * @author admin
 * @date 2021-01-07
 */
@Service
public class CompanyInfoServiceImpl implements ICompanyInfoService
{
    @Autowired
    private CompanyInfoMapper companyInfoMapper;

    /**
     * 查询企业简介
     *
     * @param id 企业简介ID
     * @return 企业简介
     */
    @Override
    public CompanyInfo selectCompanyInfoById(String id)
    {
        return companyInfoMapper.selectCompanyInfoById(id);
    }

    @Override
    public Integer selectCompanyInfoCountByCompanyId(String companyId) {
        return companyInfoMapper.selectCompanyInfoCountByCompanyId(companyId);
    }

    /**
     * 查询企业简介列表
     *
     * @param companyInfo 企业简介
     * @return 企业简介
     */
    @Override
    public List<CompanyInfo> selectCompanyInfoList(CompanyInfo companyInfo)
    {
        return companyInfoMapper.selectCompanyInfoList(companyInfo);
    }

    /**
     * 新增企业简介
     *
     * @param companyInfo 企业简介
     * @return 结果
     */
    @Override
    public int insertCompanyInfo(CompanyInfo companyInfo)
    {
        companyInfo.setId(UUID.randomUUID().toString().replace("-",""));
        return companyInfoMapper.insertCompanyInfo(companyInfo);
    }

    /**
     * 修改企业简介
     *
     * @param companyInfo 企业简介
     * @return 结果
     */
    @Override
    public int updateCompanyInfo(CompanyInfo companyInfo)
    {
        return companyInfoMapper.updateCompanyInfo(companyInfo);
    }

    /**
     * 删除企业简介对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCompanyInfoByIds(String ids)
    {
        return companyInfoMapper.deleteCompanyInfoByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除企业简介信息
     *
     * @param id 企业简介ID
     * @return 结果
     */
    @Override
    public int deleteCompanyInfoById(String id)
    {
        return companyInfoMapper.deleteCompanyInfoById(id);
    }

    @Override
    public CompanyInfo selectCompanyInfoByCompanyId(String companyId) {
        return companyInfoMapper.selectCompanyInfoByCompanyId(companyId);
    }
}
